package com.gitee.pifeng.monitoring.server.business.server.service.impl;

import com.gitee.pifeng.monitoring.common.constant.MonitorTypeEnums;
import com.gitee.pifeng.monitoring.common.constant.alarm.AlarmLevelEnums;
import com.gitee.pifeng.monitoring.common.constant.alarm.AlarmReasonEnums;
import com.gitee.pifeng.monitoring.common.domain.Alarm;
import com.gitee.pifeng.monitoring.common.domain.Result;
import com.gitee.pifeng.monitoring.common.dto.AlarmPackage;
import com.gitee.pifeng.monitoring.common.util.Md5Utils;
import com.gitee.pifeng.monitoring.server.business.server.core.PackageConstructor;
import com.gitee.pifeng.monitoring.server.business.server.domain.Mail;
import com.gitee.pifeng.monitoring.server.business.server.service.IAlarmService;
import com.gitee.pifeng.monitoring.server.business.server.service.IFeedBackService;
import com.gitee.pifeng.monitoring.server.business.server.service.IMailService;
import lombok.extern.slf4j.Slf4j;
import org.hyperic.sigar.SigarException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Objects;
import java.util.UUID;

@Service
@Slf4j
public class FeedBackServiceImpl implements IFeedBackService {

    @Autowired
    private IMailService mailService;
    @Override
    public Boolean sendFeedMail(String toMail,String type) throws SigarException {
            Mail mail = new Mail();
        if (Objects.equals(type, "0")) {
            String[] strings = new String[]{toMail};
            mail.setEmail(strings);
            mail.setTitle("运维单通知信息");
            mail.setContent("你有一条新的运维单信息，请及时处理");
            mail.setLevel("INFO");
            return mailService.sendAlarmTemplateMail(mail);
        }else {
            String[] strings = new String[]{toMail};
            mail.setEmail(strings);
            mail.setTitle("运维单通知信息");
            mail.setContent("你所提交的问题已经解决，请及时查看");
            mail.setLevel("INFO");
            return mailService.sendAlarmTemplateMail(mail);
        }
    }
}
